package loc

import (
	"beergo/app/check/models"
	"beergo/conf/const/code"
	"beergo/lib/base/controller"
	"beergo/lib/event"
	"github.com/beego/beego/v2/server/web"
)

type LocSncController struct {
	controller.ContainerController
}

func init() {
	web.Router("/_loc/org_update_event_:id",&LocSncController{},"*:UpdateOrgLatLonAction")
}

func (this *LocSncController) UpdateOrgLatLonAction() {
	id:=this.GetParamInt(":id")
	rep:=models.OrgRepository{}
	org:=rep.Find(id)
	if org.Id != 0 {
		event.DispatchToMany("check.AfterOrgUpdate",org,this.Ctx)
		this.ReturnSuccess("OK","")
	}else {
		this.ReturnError(code.Error,"Not Found","")
	}
}